Code Snippet - Definining Dictionary

Python Dictionaries - Dictionary

Created: 2022-07-26
Tags: #fleeting


THREE WAYS TO DEFINE DICTIONARY

1st Way

d = {
    'key': 'value', 
    'key': 'value'
}

2rd Way (If key-value pair are all strings)

d = dict(
    key = 'value',
    key = 'value'
)

References